#!usr/bin/python
# -*- coding: UTF-8 -*-
print(type(len))
print(type(int))
print(type(list))

class C:
    pass   #占位符，啥都不干，光继承
print(type(C))

a = int('123')
b = int('420')
print(a)
print(b)
print(a + b)

class New_int(int):
    def __add__(self, other):
        return int.__sub__(self, other)
    def __sub__(self, other):
        return int.__add__(self, other)

a = New_int(3)
b = New_int(5)
print('a + b = ' , (a + b))
print('a - b = ' , (a - b))

class Try_int(int):
    def __add__(self, other):
        return int(self) + int(other) #  3 + 5进入无限递归
        return self + other #  3 + 5进入无限递归
    def __sub__(self, other):
        return int(self) - int(other)
        return self - other
a = Try_int(3)
b = Try_int(5)
print('a + b', a + b)
print('a - b', a - b)



#
class Nint(int):
    def __radd__(self, other):
        return int.__sub__(self, other)

a = Nint(5)
b = Nint(3)
print('a + b = ', a + b)

class Nint(int):
    def __rsub__(self, other):
        return int.__sub__(self, other)
a = Nint(5)
print(3 - a)

class Nint(int):
    def __rsub__(self, other):
        return int.__sub__(self, other)
a = a + b
print(a)
print(a + b)






